﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using CCF20Model;
using WiseLinkWPF.Windows.Controls.GridView;
using WiseLinkWPF.Windows.Controls;

namespace CCF20
{
    public class CustomerCareStyle : System.Windows.Controls.StyleSelector
    {
        public override Style SelectStyle(object item, DependencyObject container)
        {
            var cell = container as GridViewCell;
            var myColumn = cell.Column as GridViewDataColumn;
            string uniqueName = myColumn.UniqueName;

            if (item is VehicleData)
            {

                VehicleData vehicleData = item as VehicleData;
                switch (uniqueName)
                {
                    case "IsUrgent":
                        if (vehicleData.MyVehicle.UrgentCount > 0)
                        {
                            return UrgentStyle;
                        }
                        break;
                    case "IsConfirmedFaultCount":
                        if (vehicleData.MyVehicle.ConfirmedFaultCount > 0)
                        {
                            return FaultStyle;
                        }
                        break;
                    case "IsUnConfirmedFaultCount":
                        if (vehicleData.MyVehicle.UnConfirmedFaultCount > 0)
                        {
                            return FaultStyle;
                        }
                        break;
                    case "IsMaintenance":
                        if (vehicleData.MyVehicle.MaintenanceCount > 0)
                        {
                            return MaintenanceStyle;
                        }
                        break;
                }
            }
            //else if (item is Device)
            //{
            //    Device device = item as Device;
            //    switch (uniqueName)
            //    {
            //        case "注册IDC":
            //            if (device.IsRegistered != null && (bool)device.IsRegistered)
            //            {
            //                return RegisteredStyle;
            //            }
            //            break;
                        
            //        case "特殊IDC":
            //            if (device.IsSpecialIDC != null && (bool)device.IsSpecialIDC )
            //            {
            //                return SpecialIDCStyle;
            //            }
            //            break;
            //    }
            //}
            return null;
            
        }
        public Style UrgentStyle { get; set; }
        public Style FaultStyle { get; set; }
        public Style MaintenanceStyle { get; set; }
        
    }
}
